package com.kawa.controller;

import com.kawa.model.R;
import com.kawa.service.LogoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class LogoutController {

    @Autowired
    private LogoutService logoutService;

    @GetMapping("/logout")
    public R Logout(@RequestHeader("Authorization")String token) {

        return logoutService.UserLogout(token) ? R.ok() : R.fail();

    }

}
